<?php
/****
	桥接模式
****/
header('Content-type:text/html;charset=utf-8');

//服务器端代码
abstract class Info{
	protected $send = null;

	public function __construct($send){
		$this->send = $send;
	}

	abstract public function msg($content);

	public function send($to,$content){
		$content = $this->msg($content);
		$this->send->send($to,$content);
	}	
}

class Zn{
	public function send($to,$content){
		echo "站内".$to."内容是：".$content;
	}
}

class Email{
	public function send($to,$content){
		echo "email".$to."内容是：".$content;
	}
}

class Sms{
	public function send($to,$content){
		echo "sms".$to."内容是：".$content;
	}
}

class CommonInfo extends Info{
	public function msg($content){
		return $content;
	}
}

class DangerInfo extends Info{
	public function msg($content){
		return "特急".$content;
	}
}

//用站内发普通信息
$info = new CommonInfo(new Zn());
$info->send('小米','吃饭了');
echo "<br>";

//用sms特急信息
$info = new DangerInfo(new Sms());
$info->send('小花','去看电影');
echo "<br>";














